package com.doradance.app.mine;

import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.doradance.R;
import com.doradance.account.UrlCenter;
import com.doradance.account.utils.ProviderUtils;
import com.doradance.app.MainActivity;
import com.doradance.app.appactivity.AddBabyActivity;
import com.doradance.app.appactivity.LQRPhotoSelectUtils;
import com.doradance.common.http.MyHttpRequest;
import com.doradance.common.web.CommonWebviewFragment;
import com.doradance.entity.FaqsEntity;
import com.pachong.android.baseuicomponent.activity.BaseActivity;
import com.pachong.android.framework.httprequest.responsecallbacks.DataRequestListener;
import com.pachong.android.frameworkbase.dialog.AlertDialogFragment;
import com.pachong.android.frameworkbase.utils.EasyToast;

import java.util.ArrayList;
import java.util.List;

import butterknife.OnClick;
import kr.co.namee.permissiongen.PermissionGen;
import kr.co.namee.permissiongen.PermissionSuccess;

public class HelpActivity extends BaseActivity {
    ArrayList<FaqsEntity> faqsEntities;
    private CommonWebviewFragment mWebviewFragment;
    private static final int REQ_SELECT_CALL_PHONE = 100;
    private String mUrl;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initToolsBar();
        initData();
        checkPermission();
    }

    private void checkPermission() {
        PermissionGen.needPermission(HelpActivity.this,
                REQ_SELECT_CALL_PHONE,
                new String[]{Manifest.permission.CALL_PHONE}
        );
    }

    @PermissionSuccess(requestCode = REQ_SELECT_CALL_PHONE)
    private void selectPhoto() {
    }

    private void initData() {
        mUrl ="http://h5.doradance.cn/#/help";
        mWebviewFragment = CommonWebviewFragment.newInstance(mUrl);
        getSupportFragmentManager().beginTransaction().add(R.id.fl_help, mWebviewFragment).commit();


    }

    private void initToolsBar() {
        setTitle("帮助与反馈");
        getCustomToolbar().addLeftImageButton(R.mipmap.back, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

    }

    @Override
    public View createDataView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.activity_help, null);
    }

    public static void start(Activity activity) {
        Intent intent = new Intent(activity, HelpActivity.class);
        activity.startActivity(intent);
    }




}
